package edu.uta.cfl.GUI;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SwingConstants;
import javax.swing.border.BevelBorder;

public class NewProject_Dialog extends JDialog {

	private JTextField ipm_textField;
	private JTextField textField_scPath;
	private JTextField textField_scFileName;
	private JTextField textField_rtsPath;
	private JTextField textField_rtsFileName;
	private JTextField projectName_textField;
	private JTextField sourceCode_textField;
	JFrame frame;
	Dimension dimension;
	
	
	//Variables to store user input values
	
	public String projectName;
	public String inputFileLocation;
	public String rts_PathName;
	public String rts_FileName;
	public String sc_PathName;
	public String sc_FileName;
	public Boolean fileReadSuccess;
	public String dirName;
	public String sourceCodeFileLocation;
	/**
	 * @return the projectName
	 */
	public String getProjectName() {
		return projectName;
	}

	/**
	 * @param projectName the projectName to set
	 */
	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	/**
	 * @return the inputFileLocation
	 */
	public String getInputFileLocation() {
		return inputFileLocation;
	}

	/**
	 * @param inputFileLocation the inputFileLocation to set
	 */
	public void setInputFileLocation(String inputFileLocation) {
		this.inputFileLocation = inputFileLocation;
	}

	/**
	 * @return the rts_PathName
	 */
	public String getRts_PathName() {
		return rts_PathName;
	}

	/**
	 * @param rts_PathName the rts_PathName to set
	 */
	public void setRts_PathName(String rts_PathName) {
		this.rts_PathName = rts_PathName;
	}

	/**
	 * @return the rts_FileName
	 */
	public String getRts_FileName() {
		return rts_FileName;
	}

	/**
	 * @param rts_FileName the rts_FileName to set
	 */
	public void setRts_FileName(String rts_FileName) {
		this.rts_FileName = rts_FileName;
	}

	/**
	 * @return the sc_PathName
	 */
	public String getSc_PathName() {
		return sc_PathName;
	}

	/**
	 * @param sc_PathName the sc_PathName to set
	 */
	public void setSc_PathName(String sc_PathName) {
		this.sc_PathName = sc_PathName;
	}

	/**
	 * @return the sc_FileName
	 */
	public String getSc_FileName() {
		return sc_FileName;
	}

	/**
	 * @param sc_FileName the sc_FileName to set
	 */
	public void setSc_FileName(String sc_FileName) {
		this.sc_FileName = sc_FileName;
	}

	/**
	 * @return the fileReadSuccess
	 */
	public Boolean getFileReadSuccess() {
		return fileReadSuccess;
	}

	/**
	 * @param fileReadSuccess the fileReadSuccess to set
	 */
	public void setFileReadSuccess(Boolean fileReadSuccess) {
		this.fileReadSuccess = fileReadSuccess;
	}

	/**
	 * @return the dirName
	 */
	public String getDirName() {
		return dirName;
	}

	/**
	 * @param dirName the dirName to set
	 */
	public void setDirName(String dirName) {
		this.dirName = dirName;
	}

	/**
	 * @return the sourceCodeFileLocation
	 */
	public String getSourceCodeFileLocation() {
		return sourceCodeFileLocation;
	}

	/**
	 * @param sourceCodeFileLocation the sourceCodeFileLocation to set
	 */
	public void setSourceCodeFileLocation(String sourceCodeFileLocation) {
		this.sourceCodeFileLocation = sourceCodeFileLocation;
	}

	// Constructor for the NewProject_Dialog
	public NewProject_Dialog()
	{
		initialize();
	}

	private void initialize() {
		frame = new JFrame();
		Dimension windowSize = new Dimension(450,420);
		frame.setPreferredSize(windowSize);  // setBounds(int x co-ordinate, int y co-ordinate, int height, int width)
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setDefaultLookAndFeelDecorated(true);
		frame.setLocationRelativeTo(null);  // to position the window center on the screen
		frame.setTitle("New Debugging Project"); 
		frame.getContentPane().setLayout(new BorderLayout());
		final fileInfo obj = new fileInfo(); //testing
		
		setFileReadSuccess(false);
		//testing data
		setLayout(new BoxLayout(getContentPane(),BoxLayout.Y_AXIS));
		add(Box.createRigidArea(new Dimension(0,10)));
		
		JPanel panel = new JPanel();
		
		
		JPanel panel_SC = new JPanel();  // Panel for Suspicious Combination input 
		panel_SC.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
		
		JPanel panel_RTS = new JPanel(); // Panel for Recommended Test Set input
		panel_RTS.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
		
		JSeparator separator = new JSeparator();
		
		JButton createProject_button = new JButton("Create");
		
		JButton cancelProject_button = new JButton("Cancel");
		
		JLabel lbl_projectName = new JLabel("Project Name:");
		lbl_projectName.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
		lbl_projectName.setVerticalAlignment(SwingConstants.TOP);
		
		projectName_textField = new JTextField();
		projectName_textField.setColumns(10);
		projectName_textField.setToolTipText("Project name");
		
		JLabel lbl_ipm = new JLabel("Input File Location:");
		lbl_ipm.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
		
		ipm_textField = new JTextField();
		ipm_textField.setColumns(20);
		//ipm_textField.setEnabled(false); // to prevent users from entering invalid directory
		ipm_textField.setToolTipText("To Select input file, click on the \"Select Input File\" Button");
		
		JButton btnSelectInputFile = new JButton("Select Input File");
		btnSelectInputFile.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
		
		JLabel lbl_sourceCode = new JLabel("Source Code:");
		lbl_sourceCode.setFont(new Font("Lucida Grande",Font.PLAIN,11));
		
		sourceCode_textField = new JTextField();
		sourceCode_textField.setColumns(15);
		//sourceCode_textField.setEnabled(false);
		sourceCode_textField.setToolTipText("Source Code File location");
		
		JButton btnSelectSourceCodeFile = new JButton("Select Source Code File");
		btnSelectSourceCodeFile.setFont(new Font("Lucida Grande",Font.PLAIN,11));
		
		
		JSeparator separator_1 = new JSeparator();
		
		JLabel lblSuspiciousCombination = new JLabel("Suspicious Combination :");
		
		JLabel lblRTS = new JLabel("Recommended Test Set:");
		
		JPanel labelPanel = new JPanel();
		FlowLayout fl_labelPanel = (FlowLayout) labelPanel.getLayout();
		fl_labelPanel.setAlignment(FlowLayout.LEFT);
		labelPanel.setBackground(Color.WHITE);
		labelPanel.setBorder(null);
		
		JSeparator separator_2 = new JSeparator();
		GroupLayout gl_panel = new GroupLayout(panel);
		gl_panel.setHorizontalGroup(
			gl_panel.createParallelGroup(Alignment.LEADING)
				.addGroup(Alignment.TRAILING, gl_panel.createSequentialGroup()
					.addContainerGap(417, Short.MAX_VALUE)
					.addComponent(createProject_button)
					.addGap(18)
					.addComponent(cancelProject_button)
					.addGap(178))
				.addGroup(gl_panel.createSequentialGroup()
					.addContainerGap()
					.addComponent(separator, GroupLayout.DEFAULT_SIZE, 752, Short.MAX_VALUE)
					.addContainerGap())
				.addComponent(labelPanel, GroupLayout.DEFAULT_SIZE, 776, Short.MAX_VALUE)
				.addGroup(gl_panel.createSequentialGroup()
					.addContainerGap()
					.addComponent(separator_1, GroupLayout.PREFERRED_SIZE, 1, GroupLayout.PREFERRED_SIZE)
					.addGap(28)
					.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
						.addComponent(panel_RTS, GroupLayout.PREFERRED_SIZE, 462, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblSuspiciousCombination)
						.addComponent(panel_SC, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblRTS)
						.addGroup(gl_panel.createSequentialGroup()
							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
								.addComponent(lbl_sourceCode)
								.addComponent(lbl_ipm)
								.addComponent(lbl_projectName, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE))
							.addPreferredGap(ComponentPlacement.RELATED, 29, Short.MAX_VALUE)
							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING, false)
								.addComponent(projectName_textField)
								.addComponent(ipm_textField, GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
								.addComponent(sourceCode_textField))
							.addGap(29)
							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
								.addComponent(btnSelectSourceCodeFile)
								.addComponent(btnSelectInputFile))))
					.addGap(189))
				.addGroup(gl_panel.createSequentialGroup()
					.addContainerGap()
					.addComponent(separator_2, GroupLayout.DEFAULT_SIZE, 752, Short.MAX_VALUE)
					.addContainerGap())
		);
		gl_panel.setVerticalGroup(
			gl_panel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel.createSequentialGroup()
					.addContainerGap()
					.addComponent(labelPanel, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(separator_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
					.addGap(8)
					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
						.addComponent(lbl_projectName)
						.addComponent(projectName_textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(26)
					.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
						.addComponent(btnSelectInputFile)
						.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
							.addComponent(lbl_ipm)
							.addComponent(ipm_textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
					.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel.createSequentialGroup()
							.addGap(26)
							.addComponent(lbl_sourceCode))
						.addGroup(gl_panel.createSequentialGroup()
							.addGap(18)
							.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
								.addComponent(btnSelectSourceCodeFile)
								.addComponent(sourceCode_textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
					.addGap(34)
					.addComponent(separator_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
					.addGap(14)
					.addComponent(lblSuspiciousCombination)
					.addGap(18)
					.addComponent(panel_SC, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
					.addGap(27)
					.addComponent(lblRTS)
					.addGap(18)
					.addComponent(panel_RTS, GroupLayout.PREFERRED_SIZE, 92, GroupLayout.PREFERRED_SIZE)
					.addGap(24)
					.addComponent(separator, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
						.addComponent(createProject_button)
						.addComponent(cancelProject_button))
					.addContainerGap(26, Short.MAX_VALUE))
		);
		
		JLabel lblNewLabel_6 = new JLabel("Create a New Project");
		lblNewLabel_6.setFont(new Font("Lucida Grande", Font.BOLD, 14));
		labelPanel.add(lblNewLabel_6);
		
		JLabel lblNewLabel_3 = new JLabel("Path:");
		lblNewLabel_3.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
		
		textField_rtsPath = new JTextField();
		textField_rtsPath.setColumns(10);
		//textField_rtsPath.setEnabled(false);
		textField_rtsPath.setToolTipText("To Select input file, click on the \"Select Destination Folder\" Button");
		
		JButton btnPath_rts = new JButton("Select Destination Folder");
		btnPath_rts.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
		
		JLabel lblNewLabel_4 = new JLabel("File Name:");
		lblNewLabel_4.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
		
		textField_rtsFileName = new JTextField();
		textField_rtsFileName.setColumns(10);
		textField_rtsFileName.setToolTipText("File Name for Recommended Test Set");
		GroupLayout gl_panel_RTS = new GroupLayout(panel_RTS);
		gl_panel_RTS.setHorizontalGroup(
			gl_panel_RTS.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_RTS.createSequentialGroup()
					.addGroup(gl_panel_RTS.createParallelGroup(Alignment.LEADING, false)
						.addGroup(gl_panel_RTS.createSequentialGroup()
							.addGap(5)
							.addComponent(lblNewLabel_3)
							.addGap(54)
							.addComponent(textField_rtsPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_panel_RTS.createSequentialGroup()
							.addContainerGap()
							.addComponent(lblNewLabel_4)
							.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
							.addComponent(textField_rtsFileName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
					.addGap(18)
					.addComponent(btnPath_rts)
					.addContainerGap(15, Short.MAX_VALUE))
		);
		gl_panel_RTS.setVerticalGroup(
			gl_panel_RTS.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_RTS.createSequentialGroup()
					.addGap(5)
					.addGroup(gl_panel_RTS.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblNewLabel_3)
						.addComponent(textField_rtsPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(btnPath_rts))
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(gl_panel_RTS.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblNewLabel_4)
						.addComponent(textField_rtsFileName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addContainerGap())
		);
		panel_RTS.setLayout(gl_panel_RTS);
		
		JLabel lblNewLabel_1 = new JLabel("Path:");
		lblNewLabel_1.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
		
		textField_scPath = new JTextField();
		textField_scPath.setColumns(10);
		//textField_scPath.setEnabled(false);
		textField_scPath.setToolTipText("To Select input file, click on the \"Select Destination Folder\" Button");
		
		JButton btnPath_sc = new JButton("Select Destination Folder");
		btnPath_sc.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
		
		JLabel lblNewLabel_2 = new JLabel("File Name:");
		lblNewLabel_2.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
		
		textField_scFileName = new JTextField();
		textField_scFileName.setColumns(10);
		textField_scFileName.setToolTipText("File Name for Suspicious Combination");
		GroupLayout gl_panel_SC = new GroupLayout(panel_SC);
		gl_panel_SC.setHorizontalGroup(
			gl_panel_SC.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_SC.createSequentialGroup()
					.addGroup(gl_panel_SC.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel_SC.createSequentialGroup()
							.addContainerGap()
							.addComponent(lblNewLabel_2))
						.addGroup(gl_panel_SC.createSequentialGroup()
							.addGap(5)
							.addComponent(lblNewLabel_1)))
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(gl_panel_SC.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel_SC.createSequentialGroup()
							.addComponent(textField_scPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
							.addComponent(btnPath_sc))
						.addComponent(textField_scFileName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addContainerGap())
		);
		gl_panel_SC.setVerticalGroup(
			gl_panel_SC.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_SC.createSequentialGroup()
					.addGroup(gl_panel_SC.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel_SC.createSequentialGroup()
							.addGap(11)
							.addComponent(lblNewLabel_1))
						.addGroup(gl_panel_SC.createSequentialGroup()
							.addGap(5)
							.addGroup(gl_panel_SC.createParallelGroup(Alignment.BASELINE)
								.addComponent(btnPath_sc)
								.addComponent(textField_scPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
					.addGroup(gl_panel_SC.createParallelGroup(Alignment.TRAILING)
						.addGroup(gl_panel_SC.createSequentialGroup()
							.addPreferredGap(ComponentPlacement.UNRELATED)
							.addComponent(lblNewLabel_2)
							.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
						.addGroup(gl_panel_SC.createSequentialGroup()
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(textField_scFileName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addContainerGap())))
		);
		
		panel_SC.setLayout(gl_panel_SC);
		panel.setLayout(gl_panel);

		
//button logic
// Button Logic
		createProject_button.addActionListener(new ActionListener(){
			
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				
				//validation logic
				if(projectName_textField.getText().trim().isEmpty())
				{
					JOptionPane.showMessageDialog(frame, "Please enter Project Name","Invalid Input Error",JOptionPane.ERROR_MESSAGE);

				}
				
				else if (ipm_textField.getText().trim().isEmpty())
				{
					JOptionPane.showMessageDialog(frame, "Please select input file Name","Invalid Input Error",JOptionPane.ERROR_MESSAGE);
				}
				
				else if(textField_rtsPath.getText().trim().isEmpty())
				{
					JOptionPane.showMessageDialog(frame, "Please Select Path for Recommmended Test Set","Invalid Input Error",JOptionPane.ERROR_MESSAGE);

				}
				
				else if(textField_rtsFileName.getText().trim().isEmpty())
				{
					JOptionPane.showMessageDialog(frame, "Please enter File Name for Recommmended Test Set","Invalid Input Error",JOptionPane.ERROR_MESSAGE);

				}
				
				else if(textField_scFileName.getText().trim().isEmpty())
				{
					JOptionPane.showMessageDialog(frame, "Please Select Path for Suspicious Combinations","Invalid Input Error",JOptionPane.ERROR_MESSAGE);

				}
				
				else if(textField_scPath.getText().trim().isEmpty())
				{
					JOptionPane.showMessageDialog(frame, "Please enter File Name for Suspicious Combinations","Invalid Input Error",JOptionPane.ERROR_MESSAGE);

				}
				else if(sourceCode_textField.getText().trim().isEmpty())
				{
					JOptionPane.showMessageDialog(frame, "Please select the source code file","Invalid Input Error",JOptionPane.ERROR_MESSAGE);
				}
				else
				{
				//storing the info in the variables
					setProjectName(projectName_textField.getText());
					setInputFileLocation(ipm_textField.getText());
					setRts_PathName(textField_rtsPath.getText());
					setRts_FileName(textField_rtsFileName.getText());
					setSc_PathName(textField_scPath.getText());
					setSc_FileName(textField_scFileName.getText());
					//obj.setCreatefile_success(true);
					//JOptionPane.showMessageDialog(frame, "Success","SUCCESS", JOptionPane.INFORMATION_MESSAGE);
					setFileReadSuccess(true);
					dispose();
				}
				
			}});
		
		btnSelectInputFile.addActionListener(new ActionListener()
		{ // input file assign logic
			public void actionPerformed(ActionEvent e) 
			{
				JFileChooser f1 = new JFileChooser();
				int returnVal = f1.showOpenDialog(frame);
		        if (returnVal == JFileChooser.APPROVE_OPTION)
		        {
		        	File file = f1.getSelectedFile();
		        	String fileName = file.toString();
		        	dirName = f1.getCurrentDirectory().toString();
		        	System.out.println("File Name:"+fileName);
		        	//ipm_textField.setEnabled(true);
		        	ipm_textField.setText(fileName);
		        	textField_scPath.setText(dirName);
		        	textField_rtsPath.setText(dirName);
		        	//ipm_textField.setEnabled(false);
		        	//textField_scPath.setEnabled(false);
		        	//textField_rtsPath.setEnabled(false);
		        }
			}});
		btnSelectSourceCodeFile.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				// source code file location
				JFileChooser f1 = new JFileChooser();
				int returnVal = f1.showOpenDialog(frame);
				if(returnVal == JFileChooser.APPROVE_OPTION)
				{
					File file = f1.getSelectedFile();
					String sourceCodeFileLocation = file.toString();
					sourceCode_textField.setText(sourceCodeFileLocation);
					setSourceCodeFileLocation(sourceCodeFileLocation);
				}
				
			}});
		
		btnPath_sc.addActionListener(new ActionListener(){
			// Suspicious Combination - Path assigning logic
			@Override
			public void actionPerformed(ActionEvent arg0) {
				JFileChooser f1 = new JFileChooser();
				File location;
				if(textField_scPath.getText().isEmpty()==false)
				{
					location = new File(textField_scPath.getText());
					System.out.println("Current Directory"+ location);
					f1.setCurrentDirectory(location);
				}
				f1.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
				f1.setAcceptAllFileFilterUsed(false);
				int returnVal = f1.showOpenDialog(frame);
		        if (returnVal == JFileChooser.APPROVE_OPTION)
		        {
		        	
		        	String fileName = f1.getCurrentDirectory().toString();
		        	System.out.println("File Name:"+fileName);
		        	//textField_scPath.setEnabled(true);
		        	textField_scPath.setText(fileName);
		        	//textField_scPath.setEnabled(false);
		        	
		        }
				
			}});
		
		//Setting path for Suspicious Combinations
		btnPath_rts.addActionListener(new ActionListener(){
			// Recommended Test Set - Path selection logic.
			@Override
			public void actionPerformed(ActionEvent e) {
				JFileChooser f1 = new JFileChooser();
				File location;
				if(textField_rtsPath.getText().isEmpty()==false)
				{
					location = new File(textField_rtsPath.getText());
					System.out.println("Current Directory"+ location);
					f1.setCurrentDirectory(location);
				}
				f1.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
				f1.setAcceptAllFileFilterUsed(false);
				int returnVal = f1.showOpenDialog(frame);
		        if (returnVal == JFileChooser.APPROVE_OPTION)
		        {
		        	
		        	String pathName = f1.getCurrentDirectory().toString();
		        	System.out.println("Destination Directory Name:"+pathName);
		        	//textField_rtsPath.setEnabled(true);
		        	textField_rtsPath.setText(pathName);
		        	//textField_rtsPath.setEnabled(false);
		        	
		        }
				
			}});
		

		cancelProject_button.addActionListener(new ActionListener(){
			// Cancel the project logic
			@Override
			public void actionPerformed(ActionEvent e) {
				setFileReadSuccess(false);
				dispose();
				
			}});
	
		
		
		//frame.getContentPane().add(panel);
		//frame.pack();
		//frame.setVisible(true);
		add(panel);
		dimension = new Dimension(570,565);
		setModalityType(ModalityType.APPLICATION_MODAL);
		setTitle("New Project");
		setSize(570,645); // width,height
		setResizable(false); // user should not be able to re-size the screen size
		//setPreferredSize(dimension);
		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		setLocationRelativeTo(null);
		
	} // end of initialize(); method



}